package cn.edu.scau.cmi.zhuangzhihong.singletonmodel;

import java.util.ArrayList;
import java.util.List;

import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;

import javafx.scene.control.Label;
import javafx.stage.Stage;

public class viewController {
	@FXML
	private Button newleader;
	@FXML
	private Button showleader;
	@FXML
	private Button closew;
	@FXML
	private Label time;
	@FXML
	private Label lname;
	@FXML
	private Label num;
	@FXML
	private Label judge;
	@FXML
	private Label m1;
	@FXML
	private Label m2;
	@FXML
	private Label m3;
	@FXML
	private Label m4;
	@FXML
	private Label m5;
	@FXML
	private Label m6;
	@FXML
	private Label m7;
	@FXML
	private Label m8;
	@FXML
	private Label m9;
	@FXML
	private Label m10;

	 public president lastleader;
	 public List<marshal> mar;
	  public void creatpresident(ActionEvent event) {
	       //System.out.println("Button Clicked!");
	       List<president> leader = new ArrayList<president>();
	       lastleader = president.getInstance();
	        
	       leader.add(lastleader);
	       //System.out.println(lastleader.getname()+lastleader.gettime());
	       
	        String t = Integer.toString(lastleader.gettime());
	        // Show in VIEW
	        lname.setText(lastleader.getname());
	        time.setText(t);
	   }
	  public void changeWindow() throws Exception {
		 
		  Parent target = FXMLLoader.load(getClass().getResource("tellpresident.fxml"));//���봰��B�Ķ����ļ���<span style="white-space:pre">	</span>
		  Scene scene = new Scene(target); //����������
		  Stage stg=new Stage();//������̨��
		  stg.setScene(scene); //������������̨��
		  stg.show(); //��ʾ���ڣ
		 
			
}
	  public void closew(ActionEvent event) {
		  Stage stage=(Stage)closew.getScene().getWindow();
		  stage.close();
	  }
	  public void creatmarshal1(ActionEvent event) {
	       System.out.println("Button Clicked!");
	        mar = new ArrayList<marshal>();
	       mar = marshal.getInstance();
	        
	       
	       
	    	   m1.setText(mar.get(0).getName());
	    	   m2.setText(mar.get(1).getName());
	    	   m3.setText(mar.get(2).getName());
	    	   m4.setText(mar.get(3).getName());
	    	   m5.setText(mar.get(4).getName());
	    	   m6.setText(mar.get(5).getName());
	    	   m7.setText(mar.get(6).getName());
	    	   m8.setText(mar.get(7).getName());
	    	   m9.setText(mar.get(8).getName());
	    	   m10.setText(mar.get(9).getName());
		       
	       
	   }
	  
	  
}

